package campus.aiit.ssl.service;

import campus.aiit.ssl.domain.model.TimedTask;
import campus.aiit.ssl.manage.cron.ManualTaskAction;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ihaokun
 * @date 2019/12/27 16:14
 */
@Service
public class TaskService {
  @Resource private ManualTaskAction action;

  public boolean addTask(TimedTask task) throws Throwable {
    return action.addTask(task);
  }

  public List<TimedTask> tasks() throws Throwable {
    return action.listByUser();
  }

  public boolean cancel(long id){
    return action.cancelTask(id);
  }

  public boolean saveTask(TimedTask task) {
    return false;
  }
}